const express = require('express');
const router = express.Router();
const pool = require('../database/db'); // 数据库连接池
const AIController = require('../controller/AIController');

// 初始化控制器
const aiController = new AIController(pool);

// 普通DeepSeek API代理接口
router.post('/chat', (req, res) => aiController.chatWithAI(req, res));

// 流式DeepSeek API代理接口
router.post('/chat/stream', (req, res) => aiController.streamChatWithAI(req, res));

// 获取AI历史记录
router.get('/chat/history', (req, res) => aiController.getHistoryMsgApi(req, res));

// 清空AI历史记录
router.delete('/chat/history', (req, res) => aiController.clearHistoryMsgApi(req, res));

// 这里可以添加更多与AI相关的路由，如农业咨询、数据咨询等

module.exports = router;